package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.SysUserRoleService;
import com.atguigu.spzx.model.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Tag(name = "用户角色管理模块")
@RequestMapping("/admin/system/userRole")
public class SysUserRoleController {
    @Resource
    SysUserRoleService sysUserRoleService;
    @Operation(summary = "给用户分配角色接口")
    @PutMapping("assignRoles2User/{userId}")
    public Result assignRoles2User(@PathVariable("userId")Long userId,
                                   //请求体提交角色id集合：  [1,2,3,4]
                                   @RequestBody List<Long> roleIds){
        sysUserRoleService.assignRoles2User(userId,roleIds);
        return Result.ok();
    }

}
